<?php

namespace app\common\model;

use think\Model;
use think\model\relation\BelongsTo;

/**
 * em_order_board_item
 * @property integer $id (主键)
 * @property integer $board_id 板车ID
 * @property integer $order_id 订单ID
 * @property string $freight_price 本段运费
 * @property string $fuel_price 加油费
 * @property string $handling_price 装卸费
 * @property string $forklift_price 叉车费
 * @property string $other_price 其他费
 * @property string $create_time 创建时间
 * @property string $update_time 编辑时间
 * @property integer $status 状态 0未结账 1已结账
 */
class OrderBoardItem extends Model
{
    /**
     * The connection name for the model.
     *
     * @var string|null
     */
    protected $connection = 'mysql';
    
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'em_order_board_item';
    
    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $pk = 'id';
    
    
    public function orderinfo()
    {
        return $this->belongsTo('Order', 'order_id')->bind(['car_brand', 'car_color', 'car_number','address','end_address','car_shelf_num']);
    }
    
    public function board()
    {
        return $this->belongsTo('OrderBoard', 'board_id')->bind(['driver_name', 'driver_mobile', 'license', 'company_name', 'company_mobile', 'company_nickname']);
    }
    
    
    public function startDept(): BelongsTo
    {
        return $this->belongsTo('Dept', 'start_dept_id')->bind(['start_dept_name' => 'name']);
    }
    
    public function dept(): BelongsTo
    {
        return $this->belongsTo('Dept', 'dept_id')->bind(['dept_name' => 'name']);
    }
    
    public function endDept(): BelongsTo
    {
        return $this->belongsTo('Dept', 'end_dept_id')->bind(['end_dept_name' => 'name']);
    }

    public function nextDept(): BelongsTo
    {
        return $this->belongsTo('Dept', 'next_dept_id')->bind(['next_dept_name' => 'name']);
    }
    
}
